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

@ -17,6 +17,10 @@ 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> busca(String nomPuntoVenta, String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta); public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada); public List<PuntoVenta> buscaPuntoVentaParada(Parada parada);
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta);
} }

View File

@ -67,11 +67,20 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return c.list(); return c.list();
} }
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada){ public List<PuntoVenta> buscaPuntoVentaParada(Parada parada) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("parada", parada)); c.add(Restrictions.eq("parada", parada));
return c.list(); 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; private Boolean indValidaStock;
@Column(name = "TIEMPOCANCELACION") @Column(name = "TIEMPOCANCELACION")
private Integer tiempoCancelacion; private Integer tiempoCancelacion;
@OneToOne
@JoinColumn(name = "PUNTOVENTAPADRE_ID")
private PuntoVenta puntoVentaPadre;
public PtovtaComissao getComissaoId() { public PtovtaComissao getComissaoId() {
return comissaoId; return comissaoId;
@ -585,4 +588,12 @@ public class PuntoVenta implements Serializable {
public void setTiempoCancelacion(Integer tiempoCancelacion) { public void setTiempoCancelacion(Integer tiempoCancelacion) {
this.tiempoCancelacion = tiempoCancelacion; this.tiempoCancelacion = tiempoCancelacion;
} }
public PuntoVenta getPuntoVentaPadre() {
return puntoVentaPadre;
}
public void setPuntoVentaPadre(PuntoVenta puntoVentaPadre) {
this.puntoVentaPadre = puntoVentaPadre;
}
} }

View File

@ -17,6 +17,10 @@ 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> buscar(String nomPuntoVenta, String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta); public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta);
public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId); public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId);
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta);
} }

View File

@ -4,22 +4,20 @@
*/ */
package com.rjconsultores.ventaboletos.service.impl; 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.Calendar;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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 * @author Administrador
@ -29,8 +27,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
@Autowired @Autowired
private PuntoVentaDAO puntoVentaDAO; private PuntoVentaDAO puntoVentaDAO;
@Autowired
private PtovtaEmpresaService ptoVtaService;
public List<PuntoVenta> obtenerTodos() { public List<PuntoVenta> obtenerTodos() {
return puntoVentaDAO.obtenerTodos(); return puntoVentaDAO.obtenerTodos();
@ -67,13 +63,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
forma.setActivo(Boolean.FALSE); forma.setActivo(Boolean.FALSE);
} }
// for (PtovtaEstoque forma : entidad.getPtovtaEstoqueList()) { // for (PtovtaEstoque forma : entidad.getPtovtaEstoqueList()) {
// forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); // forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// forma.setFecmodif(Calendar.getInstance().getTime()); // forma.setFecmodif(Calendar.getInstance().getTime());
// forma.setActivo(Boolean.FALSE); // forma.setActivo(Boolean.FALSE);
// } // }
if(entidad.getAgenciaId() != null){ if (entidad.getAgenciaId() != null) {
entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime()); entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime());
@ -81,19 +77,19 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
} }
if(entidad.getComissaoId() != null){ if (entidad.getComissaoId() != null) {
entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime()); entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime());
entidad.getComissaoId().setActivo(Boolean.FALSE); entidad.getComissaoId().setActivo(Boolean.FALSE);
} }
if(entidad.getDiversosId() != null){ if (entidad.getDiversosId() != null) {
entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime()); entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime());
entidad.getDiversosId().setActivo(Boolean.FALSE); entidad.getDiversosId().setActivo(Boolean.FALSE);
} }
if(entidad.getTitularId() != null){ if (entidad.getTitularId() != null) {
entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime()); entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime());
entidad.getTitularId().setActivo(Boolean.FALSE); entidad.getTitularId().setActivo(Boolean.FALSE);
@ -121,4 +117,11 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId) { public List<PuntoVenta> buscaPuntoVentaParada(Parada paradaId) {
return puntoVentaDAO.buscaPuntoVentaParada(paradaId); return puntoVentaDAO.buscaPuntoVentaParada(paradaId);
} }
@Override
public List<PuntoVenta> buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) {
List<PuntoVenta> lsPuntoVentaSubordinados = puntoVentaDAO.buscarPuntoVentaSubordinados(puntoVenta);
return lsPuntoVentaSubordinados;
}
} }