git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@33636 d1611594-4594-4d17-8e1d-87c2c4800839
parent
354f4e63a6
commit
86daea938a
|
@ -11,6 +11,8 @@ import org.apache.commons.lang.StringUtils;
|
||||||
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 org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.ParadaDAO;
|
import com.rjconsultores.ventaboletos.dao.ParadaDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.TramoDAO;
|
import com.rjconsultores.ventaboletos.dao.TramoDAO;
|
||||||
|
@ -30,6 +32,8 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
@Service("paradaService")
|
@Service("paradaService")
|
||||||
public class ParadaServiceImpl implements ParadaService {
|
public class ParadaServiceImpl implements ParadaService {
|
||||||
|
|
||||||
|
private static final int MAX_ANTT = 99999;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ParadaDAO paradaDAO;
|
private ParadaDAO paradaDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -42,43 +46,49 @@ public class ParadaServiceImpl implements ParadaService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public Parada suscribirActualizar(Parada entidad) throws BusinessException {
|
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());
|
List<Parada> lsParadas = paradaDAO.buscar(entidad.getCodantt());
|
||||||
|
|
||||||
if (!lsParadas.isEmpty()) {
|
if (!lsParadas.isEmpty()) {
|
||||||
if (entidad.getParadaId() == null) {
|
if (entidad.getParadaId() == null) {
|
||||||
throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste");
|
throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste");
|
||||||
} else {
|
} else {
|
||||||
if (!lsParadas.contains(entidad)){
|
if (!lsParadas.contains(entidad)) {
|
||||||
throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste");
|
throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lsParadas = paradaDAO.buscar(entidad.getDescparada(), entidad.getCveparada(), entidad.getCiudad(), entidad.getTipoParada(), entidad.getNodo());
|
lsParadas = paradaDAO.buscar(entidad.getDescparada(), entidad.getCveparada(), entidad.getCiudad(), entidad.getTipoParada(), entidad.getNodo());
|
||||||
|
|
||||||
if (!lsParadas.isEmpty()){
|
if (!lsParadas.isEmpty()) {
|
||||||
if (entidad.getParadaId() == null){
|
if (entidad.getParadaId() == null) {
|
||||||
throw new BusinessException("MSG.Registro.Existe");
|
throw new BusinessException("MSG.Registro.Existe");
|
||||||
}else{
|
} else {
|
||||||
if (!lsParadas.contains(entidad)){
|
if (!lsParadas.contains(entidad)) {
|
||||||
throw new BusinessException("MSG.Registro.Existe");
|
throw new BusinessException("MSG.Registro.Existe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lsParadas = buscarCVE(entidad.getCveparada());
|
lsParadas = buscarCVE(entidad.getCveparada());
|
||||||
|
|
||||||
if (!lsParadas.isEmpty()) {
|
if (!lsParadas.isEmpty()) {
|
||||||
if (entidad.getParadaId() == null) {
|
if (entidad.getParadaId() == null) {
|
||||||
throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste");
|
throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste");
|
||||||
} else {
|
} else {
|
||||||
if (!lsParadas.contains(entidad)){
|
if (!lsParadas.contains(entidad)) {
|
||||||
throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste");
|
throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.TRUE);
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
Loading…
Reference in New Issue