gleimar 2012-08-28 17:27:41 +00:00
parent 9d0b54f20e
commit 3c146731ef
12 changed files with 98 additions and 76 deletions

View File

@ -1,14 +1,7 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.service.SeguroKmService;
public interface SeguroKmDAO {
/**
* See {@link SeguroKmService#atualizarSeguroPorKm(Integer, Integer, Integer)}
* @param rutaId
* @param orgaoId
* @param usuarioId
*/
public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId,Integer usuarioId) ;
}

View File

@ -1,13 +1,6 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
public interface SeguroTarifaDAO {
/**
* See {@link SeguroTarifa#atualizarSeguroPorTarifa(Integer, Integer, Integer)}
* @param rutaId
* @param orgaoId
* @param usuarioId
*/
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId,Integer usuarioId);
}

View File

@ -1,6 +1,8 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
import com.rjconsultores.ventaboletos.service.SeguroKmService;
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
@ -37,4 +39,20 @@ public interface TarifaOficialDAO {
* @param orgaoConcedenteId TODO
*/
public void atualizarTaxaEmbarque(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId);
/**
* See {@link TarifaOficialService#atualizarSeguroPorKm(Integer, Integer, Integer)}
* @param rutaId
* @param orgaoId
* @param usuarioId
*/
public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId,Integer usuarioId) ;
/**
* See {@link TarifaOficialService#atualizarSeguroPorTarifa(Integer, Integer, Integer)}
* @param rutaId
* @param orgaoId
* @param usuarioId
*/
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId,Integer usuarioId);
}

View File

@ -13,18 +13,10 @@ import com.rjconsultores.ventaboletos.entidad.SeguroKm;
@Repository("seguroKmDAO")
public class SeguroKmHibernateDAO extends GenericHibernateDAO<SeguroKm, Integer> implements SeguroKmDAO {
@Autowired
private SQLBuilder sqlBuilder;
@Autowired
public SeguroKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId, Integer usuarioId) {
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorKm(rutaId, usuarioId, orgaoId));
query.executeUpdate();
}
}

View File

@ -1,30 +1,19 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import org.hibernate.SQLQuery;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
@Repository("seguroTarifaDAO")
public class SeguroTarifaHibernateDAO extends GenericHibernateDAO<SeguroTarifa, Integer> implements SeguroTarifaDAO {
@Autowired
private SQLBuilder sqlBuilder;
@Autowired
public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId, Integer usuarioId) {
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorTarifa(rutaId, usuarioId, orgaoId));
query.executeUpdate();
}
}

View File

@ -128,4 +128,16 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorParadaFixo(rutaId, usuarioId, orgaoConcedenteId));
query.executeUpdate();
}
@Override
public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId, Integer usuarioId) {
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorKm(rutaId, usuarioId, orgaoId));
query.executeUpdate();
}
@Override
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId, Integer usuarioId) {
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorTarifa(rutaId, usuarioId, orgaoId));
query.executeUpdate();
}
}

View File

@ -1,15 +1,6 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.exception.BusinessException;
public interface SeguroKmService {
/**
* Atualiza o seguro de acordo a kilometragem do trecho
*
* @param rutaId - Se informado, será filtrado pela ruta
* @param orgaoId -Campo obrigatório
*/
public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId) throws BusinessException;
}

View File

@ -4,13 +4,4 @@ import com.rjconsultores.ventaboletos.exception.BusinessException;
public interface SeguroTarifaService {
/**
* Atualiza o seguro de acordo o valor da tarifa
*
* @param rutaId - Se informado, será filtrado pela ruta
* @param orgaoId -Campo obrigatório
*
*/
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException;
}

View File

@ -1,6 +1,7 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
import com.rjconsultores.ventaboletos.exception.BusinessException;
public interface TarifaOficialService {
@ -67,4 +68,34 @@ public interface TarifaOficialService {
*/
public void atualizarTaxaEmbarque(Integer rutaId, Integer orgaoConcedenteId);
/**
* Atualiza o seguro de acordo a kilometragem do trecho
*
* @param rutaId - Se informado, será filtrado pela ruta
* @param orgaoId -Campo obrigatório
*/
public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId) throws BusinessException;
/**
* Atualiza o seguro de acordo o valor da tarifa
*
* @param rutaId - Se informado, será filtrado pela ruta
* @param orgaoId -Campo obrigatório
*
*/
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException;
/**
* Executa tanto o {@link #atualizarSeguroPorKm(Integer, Integer)} quanto {@link #atualizarSeguroPorTarifa(Integer, Integer)}
*
* @param rutaId
* @param orgaoId
* @throws BusinessException
*/
public void atualizarSeguro(Integer rutaId, Integer orgaoId) throws BusinessException;
}

View File

@ -14,17 +14,4 @@ public class SeguroServiceKmImpl implements SeguroKmService{
@Autowired
private SeguroKmDAO seguroKmDAO;
@Override
@Transactional
public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId) throws BusinessException {
if (orgaoId == null){
throw new BusinessException("SeguroServiceImpl.msg.validacion.orgaoObligatorio");
}
seguroKmDAO.atualizarSeguroPorKm(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId());
}
}

View File

@ -4,9 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.SeguroTarifaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("seguroTarifaService")
public class SeguroTarifaServiceImpl implements SeguroTarifaService {
@ -14,13 +12,6 @@ public class SeguroTarifaServiceImpl implements SeguroTarifaService {
@Autowired
private SeguroTarifaDAO seguroTarifaDAO;
@Override
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException {
if (orgaoId == null){
throw new BusinessException("SeguroServiceImpl.msg.validacion.orgaoObligatorio");
}
seguroTarifaDAO.atualizarSeguroPorTarifa(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId());
}
}

View File

@ -6,6 +6,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -49,4 +50,37 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
tarifaOficialDAO.atualizarTaxaEmbarque(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId);
}
@Override
@Transactional
public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId) throws BusinessException {
if (orgaoId == null){
throw new BusinessException("TarifaOficialServiceImpl.msg.validacion.orgaoObligatorio");
}
tarifaOficialDAO.atualizarSeguroPorKm(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId());
}
@Override
@Transactional
public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException {
if (orgaoId == null){
throw new BusinessException("TarifaOficialServiceImpl.msg.validacion.orgaoObligatorio");
}
tarifaOficialDAO.atualizarSeguroPorTarifa(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId());
}
@Override
@Transactional
public void atualizarSeguro(Integer rutaId, Integer orgaoId) throws BusinessException {
if (orgaoId == null){
throw new BusinessException("TarifaOficialServiceImpl.msg.validacion.orgaoObligatorio");
}
atualizarSeguroPorKm(rutaId, orgaoId);
atualizarSeguroPorTarifa(rutaId, orgaoId);
}
}