gleimar 2014-02-13 13:55:42 +00:00
parent 354f4e63a6
commit 86daea938a
1 changed files with 20 additions and 10 deletions

View File

@ -11,6 +11,8 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.zkoss.util.resource.Labels;
import org.zkoss.zul.Messagebox;
import com.rjconsultores.ventaboletos.dao.ParadaDAO;
import com.rjconsultores.ventaboletos.dao.TramoDAO;
@ -30,6 +32,8 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("paradaService")
public class ParadaServiceImpl implements ParadaService {
private static final int MAX_ANTT = 99999;
@Autowired
private ParadaDAO paradaDAO;
@Autowired
@ -42,13 +46,20 @@ public class ParadaServiceImpl implements ParadaService {
@Transactional
public Parada suscribirActualizar(Parada entidad) throws BusinessException {
Integer antt = entidad.getCodantt() != null ? entidad.getCodantt() : null;
if (antt != null) {
if (antt.equals(MAX_ANTT)) {
throw new BusinessException("editarCatalogoDeParadaController.MSG.maxAntt");
}
}
List<Parada> lsParadas = paradaDAO.buscar(entidad.getCodantt());
if (!lsParadas.isEmpty()) {
if (entidad.getParadaId() == null) {
throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste");
} else {
if (!lsParadas.contains(entidad)){
if (!lsParadas.contains(entidad)) {
throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste");
}
}
@ -56,24 +67,23 @@ public class ParadaServiceImpl implements ParadaService {
lsParadas = paradaDAO.buscar(entidad.getDescparada(), entidad.getCveparada(), entidad.getCiudad(), entidad.getTipoParada(), entidad.getNodo());
if (!lsParadas.isEmpty()){
if (entidad.getParadaId() == null){
if (!lsParadas.isEmpty()) {
if (entidad.getParadaId() == null) {
throw new BusinessException("MSG.Registro.Existe");
}else{
if (!lsParadas.contains(entidad)){
} else {
if (!lsParadas.contains(entidad)) {
throw new BusinessException("MSG.Registro.Existe");
}
}
}
lsParadas = buscarCVE(entidad.getCveparada());
if (!lsParadas.isEmpty()) {
if (entidad.getParadaId() == null) {
throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste");
} else {
if (!lsParadas.contains(entidad)){
if (!lsParadas.contains(entidad)) {
throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste");
}
}