Mantis: 0004070 e 0004071

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@27798 d1611594-4594-4d17-8e1d-87c2c4800839
master
rodrigo 2013-06-14 19:37:36 +00:00
parent 7202e44ee5
commit 00768ad6bb
5 changed files with 175 additions and 144 deletions

View File

@ -9,14 +9,18 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import java.util.List;
/**
*
*
* @author Administrador
*/
public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> {
public List<PuntoVenta> buscaLike(String strEstacion);
public List<PuntoVenta> buscaLike(String strEstacion);
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada);
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada);
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta);
}

View File

@ -18,60 +18,69 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
/**
*
*
* @author Administrador
*/
@Repository("puntoVentaDAO")
public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Integer>
implements PuntoVentaDAO {
implements PuntoVentaDAO {
@Autowired
public PuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Autowired
public PuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<PuntoVenta> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
@Override
public List<PuntoVenta> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("nombpuntoventa"));
c.addOrder(Order.asc("nombpuntoventa"));
return c.list();
}
return c.list();
}
public List<PuntoVenta> buscaLike(String strEstacion) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
public List<PuntoVenta> buscaLike(String strEstacion) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START));
c.add(Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START));
return c.list();
}
return c.list();
}
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("nombpuntoventa", nomPuntoVenta));
c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta));
c.add(Restrictions.eq("nombpuntoventa", nomPuntoVenta));
c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta));
return c.list();
}
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta));
return c.list();
}
return c.list();
}
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada){
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("parada", parada));
return c.list();
}
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta));
return c.list();
}
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("parada", parada));
return c.list();
}
@Override
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("puntoVentaPadre", puntoVenta));
return c.list();
}
}

View File

@ -132,6 +132,9 @@ public class PuntoVenta implements Serializable {
private Boolean indValidaStock;
@Column(name = "TIEMPOCANCELACION")
private Integer tiempoCancelacion;
@OneToOne
@JoinColumn(name = "PUNTOVENTAPADRE_ID")
private PuntoVenta puntoVentaPadre;
public PtovtaComissao getComissaoId() {
return comissaoId;
@ -585,4 +588,12 @@ public class PuntoVenta implements Serializable {
public void setTiempoCancelacion(Integer tiempoCancelacion) {
this.tiempoCancelacion = tiempoCancelacion;
}
public PuntoVenta getPuntoVentaPadre() {
return puntoVentaPadre;
}
public void setPuntoVentaPadre(PuntoVenta puntoVentaPadre) {
this.puntoVentaPadre = puntoVentaPadre;
}
}

View File

@ -9,14 +9,18 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import java.util.List;
/**
*
*
* @author Administrador
*/
public interface PuntoVentaService extends GenericService<PuntoVenta, Integer> {
public List<PuntoVenta> buscaLike(String strEstacion);
public List<PuntoVenta> buscaLike(String strEstacion);
public List<PuntoVenta> buscar(String nomPuntoVenta, String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId);
public List<PuntoVenta> buscar(String nomPuntoVenta, String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId);
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta);
}

View File

@ -4,121 +4,124 @@
*/
package com.rjconsultores.ventaboletos.service.impl;
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa;
import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.service.PtovtaEmpresaService;
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import java.util.ArrayList;
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.PuntoVentaDAO;
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
/**
*
*
* @author Administrador
*/
@Service("puntoVentaService")
public class PuntoVentaServiceImpl implements PuntoVentaService {
@Autowired
private PuntoVentaDAO puntoVentaDAO;
@Autowired
private PtovtaEmpresaService ptoVtaService;
@Autowired
private PuntoVentaDAO puntoVentaDAO;
public List<PuntoVenta> obtenerTodos() {
return puntoVentaDAO.obtenerTodos();
}
public List<PuntoVenta> obtenerTodos() {
return puntoVentaDAO.obtenerTodos();
}
public PuntoVenta obtenerID(Integer id) {
return puntoVentaDAO.obtenerID(id);
}
public PuntoVenta obtenerID(Integer id) {
return puntoVentaDAO.obtenerID(id);
}
@Transactional
public PuntoVenta suscribir(PuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
@Transactional
public PuntoVenta suscribir(PuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return puntoVentaDAO.suscribir(entidad);
}
return puntoVentaDAO.suscribir(entidad);
}
@Transactional
public PuntoVenta actualizacion(PuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
@Transactional
public PuntoVenta actualizacion(PuntoVenta entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return puntoVentaDAO.actualizacion(entidad);
}
return puntoVentaDAO.actualizacion(entidad);
}
@Transactional
public void borrar(PuntoVenta entidad) {
@Transactional
public void borrar(PuntoVenta entidad) {
for (FormaPagoDet forma : entidad.getLsFormaPagoDet()) {
forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
forma.setFecmodif(Calendar.getInstance().getTime());
forma.setActivo(Boolean.FALSE);
}
// for (PtovtaEstoque forma : entidad.getPtovtaEstoqueList()) {
// forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// forma.setFecmodif(Calendar.getInstance().getTime());
// forma.setActivo(Boolean.FALSE);
// }
if(entidad.getAgenciaId() != null){
entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime());
entidad.getAgenciaId().setActivo(Boolean.FALSE);
}
if(entidad.getComissaoId() != null){
entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime());
entidad.getComissaoId().setActivo(Boolean.FALSE);
}
if(entidad.getDiversosId() != null){
entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime());
entidad.getDiversosId().setActivo(Boolean.FALSE);
}
if(entidad.getTitularId() != null){
entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime());
entidad.getTitularId().setActivo(Boolean.FALSE);
}
for (FormaPagoDet forma : entidad.getLsFormaPagoDet()) {
forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
forma.setFecmodif(Calendar.getInstance().getTime());
forma.setActivo(Boolean.FALSE);
}
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
// for (PtovtaEstoque forma : entidad.getPtovtaEstoqueList()) {
// forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// forma.setFecmodif(Calendar.getInstance().getTime());
// forma.setActivo(Boolean.FALSE);
// }
puntoVentaDAO.actualizacion(entidad);
}
if (entidad.getAgenciaId() != null) {
public List<PuntoVenta> buscaLike(String strEstacion) {
return puntoVentaDAO.buscaLike(strEstacion);
}
entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime());
entidad.getAgenciaId().setActivo(Boolean.FALSE);
public List<PuntoVenta> buscar(String nomPuntoVenta, String numPuntoVenta) {
return puntoVentaDAO.busca(nomPuntoVenta, numPuntoVenta);
}
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta) {
return puntoVentaDAO.buscaPuntoVenta(numPuntoVenta);
}
public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId) {
return puntoVentaDAO.buscaPuntoVentaParada(paradaId);
}
}
if (entidad.getComissaoId() != null) {
entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime());
entidad.getComissaoId().setActivo(Boolean.FALSE);
}
if (entidad.getDiversosId() != null) {
entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime());
entidad.getDiversosId().setActivo(Boolean.FALSE);
}
if (entidad.getTitularId() != null) {
entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime());
entidad.getTitularId().setActivo(Boolean.FALSE);
}
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
puntoVentaDAO.actualizacion(entidad);
}
public List<PuntoVenta> buscaLike(String strEstacion) {
return puntoVentaDAO.buscaLike(strEstacion);
}
public List<PuntoVenta> buscar(String nomPuntoVenta, String numPuntoVenta) {
return puntoVentaDAO.busca(nomPuntoVenta, numPuntoVenta);
}
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta) {
return puntoVentaDAO.buscaPuntoVenta(numPuntoVenta);
}
public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId) {
return puntoVentaDAO.buscaPuntoVentaParada(paradaId);
}
@Override
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) {
List<PuntoVenta> lsPuntoVentaSubordinados = puntoVentaDAO.buscarPuntoVentaSubordinados(puntoVenta);
return lsPuntoVentaSubordinados;
}
}