Pacote - Cria configuração de pacotes (fixes bug #6041)

Tempo: 2 horas

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@41824 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2015-02-27 17:53:15 +00:00
parent 1799342c4e
commit 08456e40ce
2 changed files with 43 additions and 0 deletions

View File

@ -1,6 +1,13 @@
package com.rjconsultores.ventaboletos.service; package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.ItemAdicional;
import com.rjconsultores.ventaboletos.entidad.Pacote; import com.rjconsultores.ventaboletos.entidad.Pacote;
import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote;
public interface PacoteService extends GenericService<Pacote, Integer> { public interface PacoteService extends GenericService<Pacote, Integer> {
public Boolean verificaCadastroTarifa(Pacote pacote, TipoTarifaPacote tarifa);
public Boolean verificaCadastroItemAdicional(Pacote pacote, ItemAdicional item);
} }

View File

@ -8,8 +8,14 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.PacoteDAO; import com.rjconsultores.ventaboletos.dao.PacoteDAO;
import com.rjconsultores.ventaboletos.entidad.ItemAdicional;
import com.rjconsultores.ventaboletos.entidad.Pacote; import com.rjconsultores.ventaboletos.entidad.Pacote;
import com.rjconsultores.ventaboletos.entidad.PacoteItem;
import com.rjconsultores.ventaboletos.entidad.PacoteTarifa;
import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote;
import com.rjconsultores.ventaboletos.service.PacoteItemService;
import com.rjconsultores.ventaboletos.service.PacoteService; import com.rjconsultores.ventaboletos.service.PacoteService;
import com.rjconsultores.ventaboletos.service.PacoteTarifaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("pacoteService") @Service("pacoteService")
@ -18,6 +24,12 @@ public class PacoteServiceImpl implements PacoteService {
@Autowired @Autowired
private PacoteDAO pacoteDAO; private PacoteDAO pacoteDAO;
@Autowired
private PacoteTarifaService pacoteTarifaService;
@Autowired
private PacoteItemService pacoteItemService;
@Override @Override
public List<Pacote> obtenerTodos() { public List<Pacote> obtenerTodos() {
return pacoteDAO.obtenerTodos(); return pacoteDAO.obtenerTodos();
@ -56,4 +68,28 @@ public class PacoteServiceImpl implements PacoteService {
pacoteDAO.actualizacion(entidad); pacoteDAO.actualizacion(entidad);
} }
@Override
public Boolean verificaCadastroTarifa(Pacote pacote, TipoTarifaPacote tarifa) {
List<PacoteTarifa> pacoteTarifaLs = pacoteTarifaService.buscaTarifasPacote(pacote);
for (PacoteTarifa pacoteTarifa : pacoteTarifaLs) {
if (pacoteTarifa.getTipoTarifaPacote().equals(tarifa))
return Boolean.FALSE;
}
return Boolean.TRUE;
}
@Override
public Boolean verificaCadastroItemAdicional(Pacote pacote, ItemAdicional item) {
List<PacoteItem> pacoteItemLs = pacoteItemService.buscaItensPacote(pacote);
for (PacoteItem pacoteItem : pacoteItemLs) {
if (pacoteItem.getItemAdicional().equals(item))
return Boolean.FALSE;
}
return Boolean.TRUE;
}
} }