git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@23689 d1611594-4594-4d17-8e1d-87c2c4800839
parent
fbb0c4dbd3
commit
1273b8f71e
|
@ -65,4 +65,14 @@ public interface TramoService {
|
||||||
public List<Tramo> obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) ;
|
public List<Tramo> obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) ;
|
||||||
|
|
||||||
public Tramo suscribirActualizar(Tramo tramo) throws BusinessException ;
|
public Tramo suscribirActualizar(Tramo tramo) throws BusinessException ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gerar a descrição automática do tramo
|
||||||
|
*
|
||||||
|
* @param origen
|
||||||
|
* @param destino
|
||||||
|
* @param via
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String gerarDescripcionTramo(Parada origen, Parada destino, Via via);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,15 @@ public class TramoServiceImpl implements TramoService {
|
||||||
return tramoDAO.busca(origem, destino, via);
|
return tramoDAO.busca(origem, destino, via);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String gerarDescripcionTramo(Parada origen,Parada destino,Via via){
|
||||||
|
String descTramo = origen.getCveparada() + "-" + destino.getCveparada() + "(" + via.getNombvia() + ")";
|
||||||
|
if (descTramo.length() > 20) {
|
||||||
|
descTramo = descTramo.substring(0, 20);
|
||||||
|
}
|
||||||
|
return descTramo;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Tramo> buscarCveParada(String origen, String destino, String via) {
|
public List<Tramo> buscarCveParada(String origen, String destino, String via) {
|
||||||
return tramoDAO.buscarCveParada(origen, destino, via);
|
return tramoDAO.buscarCveParada(origen, destino, via);
|
||||||
}
|
}
|
||||||
|
@ -170,6 +179,7 @@ public class TramoServiceImpl implements TramoService {
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
public Tramo suscribirActualizar(Tramo tramo) throws BusinessException {
|
public Tramo suscribirActualizar(Tramo tramo) throws BusinessException {
|
||||||
|
|
||||||
|
|
||||||
Tramo tramoBusqueda = buscar(tramo.getOrigem(), tramo.getDestino(), tramo.getVia());
|
Tramo tramoBusqueda = buscar(tramo.getOrigem(), tramo.getDestino(), tramo.getVia());
|
||||||
|
|
||||||
if (tramo.getOrigem().equals(tramo.getDestino())) {
|
if (tramo.getOrigem().equals(tramo.getDestino())) {
|
||||||
|
@ -184,6 +194,7 @@ public class TramoServiceImpl implements TramoService {
|
||||||
throw new BusinessException("MSG.Registro.Existe.Origem.Destino.Via");
|
throw new BusinessException("MSG.Registro.Existe.Origem.Destino.Via");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tramo.getTramoId() != null) {
|
if (tramo.getTramoId() != null) {
|
||||||
boolean rutaOcupaTramo = rutaCombinacionDAO.existeTramo(tramo);
|
boolean rutaOcupaTramo = rutaCombinacionDAO.existeTramo(tramo);
|
||||||
|
|
||||||
|
@ -249,6 +260,7 @@ public class TramoServiceImpl implements TramoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tramo.setDesctramo(gerarDescripcionTramo(tramo.getOrigem(), tramo.getDestino(), tramo.getVia()));
|
||||||
tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
tramo.setFecmodif(Calendar.getInstance().getTime());
|
tramo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
tramo.setActivo(Boolean.TRUE);
|
tramo.setActivo(Boolean.TRUE);
|
||||||
|
|
|
@ -88,8 +88,7 @@ public class TramoServicioServiceImpl implements TramoServicioService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean generarTramoTiempo(Parada origen, Parada destino, Via via, BigDecimal kmsReal,
|
public boolean generarTramoTiempo(Parada origen, Parada destino, Via via, BigDecimal kmsReal,Date tiempoRecorrido, ClaseServicio claseServicio) {
|
||||||
Date tiempoRecorrido, ClaseServicio claseServicio) {
|
|
||||||
|
|
||||||
TramoServicio tramoServicio = tramoServicioDAO.buscar(origen, destino, via, claseServicio);
|
TramoServicio tramoServicio = tramoServicioDAO.buscar(origen, destino, via, claseServicio);
|
||||||
|
|
||||||
|
@ -98,11 +97,7 @@ public class TramoServicioServiceImpl implements TramoServicioService {
|
||||||
tramo = tramoService.buscar(origen, destino, via);
|
tramo = tramoService.buscar(origen, destino, via);
|
||||||
if (tramo == null) {
|
if (tramo == null) {
|
||||||
tramo = new Tramo();
|
tramo = new Tramo();
|
||||||
String descTramo = origen.getCveparada() + "-" + destino.getCveparada() + "(" + via.getNombvia() + ")";
|
tramo.setDesctramo(tramoService.gerarDescripcionTramo(origen, destino, via));
|
||||||
if (descTramo.length() > 20) {
|
|
||||||
descTramo = descTramo.substring(0, 20);
|
|
||||||
}
|
|
||||||
tramo.setDesctramo(descTramo);
|
|
||||||
tramo.setOrigem(origen);
|
tramo.setOrigem(origen);
|
||||||
tramo.setDestino(destino);
|
tramo.setDestino(destino);
|
||||||
tramo.setKmReal(kmsReal);
|
tramo.setKmReal(kmsReal);
|
||||||
|
|
Loading…
Reference in New Issue