FIXES BUG #6822
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@49998 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
aef7a093bf
commit
ded13d11a4
|
@ -10,6 +10,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.exception.IntegracionException;
|
import com.rjconsultores.ventaboletos.exception.IntegracionException;
|
||||||
import com.rjconsultores.ventaboletos.exception.ValidacionCampoException;
|
import com.rjconsultores.ventaboletos.exception.ValidacionCampoException;
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ public interface PuntoVentaService {
|
||||||
|
|
||||||
public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException;
|
public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException;
|
||||||
|
|
||||||
public void borrar(PuntoVenta entidad);
|
public void borrar(PuntoVenta entidad)throws BusinessException;
|
||||||
|
|
||||||
public List<PuntoVenta> buscaLike(String strEstacion);
|
public List<PuntoVenta> buscaLike(String strEstacion);
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,16 @@ import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO;
|
import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.exception.IntegracionException;
|
import com.rjconsultores.ventaboletos.exception.IntegracionException;
|
||||||
import com.rjconsultores.ventaboletos.exception.ValidacionCampoException;
|
import com.rjconsultores.ventaboletos.exception.ValidacionCampoException;
|
||||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EstacionService;
|
||||||
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
@ -56,7 +59,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
private PuntoVentaDAO puntoVentaDAO;
|
private PuntoVentaDAO puntoVentaDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConstanteService constanteService;
|
private ConstanteService constanteService;
|
||||||
|
@Autowired
|
||||||
|
private EstacionService estacionService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UsuarioUbicacionDAO usuarioUbicacionDAO;
|
private UsuarioUbicacionDAO usuarioUbicacionDAO;
|
||||||
|
|
||||||
|
@ -191,8 +195,20 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
return entidad;
|
return entidad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean tienesEstacionEnPuntoVta(PuntoVenta entidad) {
|
||||||
|
List<Estacion> lsEstaciones = estacionService.buscarEstaciones(entidad);
|
||||||
|
if(lsEstaciones != null && lsEstaciones.size() > 0 ){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void borrar(PuntoVenta entidad) {
|
public void borrar(PuntoVenta entidad) throws BusinessException{
|
||||||
|
|
||||||
|
if(tienesEstacionEnPuntoVta(entidad)){
|
||||||
|
throw new BusinessException("editarPuntoVentaController.MSG.estacionVinculadaAgenciaOnDelete");
|
||||||
|
}
|
||||||
|
|
||||||
for (FormaPagoDet forma : entidad.getLsFormaPagoDet()) {
|
for (FormaPagoDet forma : entidad.getLsFormaPagoDet()) {
|
||||||
forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
Loading…
Reference in New Issue