FIXES BUG #7242
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@53993 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d6e7f419ed
commit
5d15d6c332
|
@ -1,5 +1,8 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
|
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
|
||||||
|
@ -45,7 +48,7 @@ public interface TarifaOficialDAO extends GenericDAO<TarifaOficial, Integer>{
|
||||||
* @param orgaoConcedenteId TODO
|
* @param orgaoConcedenteId TODO
|
||||||
* @param empresaId TODO
|
* @param empresaId TODO
|
||||||
*/
|
*/
|
||||||
public void atualizarTaxaEmbarque(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, Integer empresaId);
|
public void atualizarTaxaEmbarque(List<Ruta> lsRuta, Integer usuarioId, Integer orgaoConcedenteId, Integer empresaId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link TarifaOficialService#atualizarSeguroPorKm(Integer, Integer, Integer)}
|
* See {@link TarifaOficialService#atualizarSeguroPorKm(Integer, Integer, Integer)}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
|
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
|
|
||||||
|
@ -136,7 +137,21 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void atualizarTaxaEmbarque(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, Integer empresaId) {
|
public void atualizarTaxaEmbarque(List<Ruta> lsRuta, Integer usuarioId, Integer orgaoConcedenteId, Integer empresaId) {
|
||||||
|
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
x=lsRuta.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
do{
|
||||||
|
Integer rutaId = null ;
|
||||||
|
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
rutaId = lsRuta.get(x-1).getRutaId();
|
||||||
|
}
|
||||||
|
|
||||||
// Atualizo a taxa de embarque de acordo a parada e km
|
// Atualizo a taxa de embarque de acordo a parada e km
|
||||||
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getAtualizarTaxaEmbarquePorKmParada(rutaId, usuarioId, orgaoConcedenteId, empresaId));
|
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getAtualizarTaxaEmbarquePorKmParada(rutaId, usuarioId, orgaoConcedenteId, empresaId));
|
||||||
|
@ -149,6 +164,8 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
||||||
// Atualizo a taxa de embarque de acordo a parada e valor fixo
|
// Atualizo a taxa de embarque de acordo a parada e valor fixo
|
||||||
query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorParadaFixo(rutaId, usuarioId, orgaoConcedenteId, empresaId));
|
query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorParadaFixo(rutaId, usuarioId, orgaoConcedenteId, empresaId));
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
|
x--;
|
||||||
|
}while(x > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
@ -56,7 +59,7 @@ public interface TarifaOficialService {
|
||||||
* @param empresaId
|
* @param empresaId
|
||||||
* @throws BusinessException
|
* @throws BusinessException
|
||||||
*/
|
*/
|
||||||
public void gerarAtualizarTarifa(Integer rudaId, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException ;
|
public void gerarAtualizarTarifa(List<Ruta> lsRuta, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copia a tarifa oficial para a tabela de tarifa de acordo com a vigencia especificada.<br/>
|
* Copia a tarifa oficial para a tabela de tarifa de acordo com a vigencia especificada.<br/>
|
||||||
|
@ -85,7 +88,7 @@ public interface TarifaOficialService {
|
||||||
* @param empresaId - Empresa para ser filtrada
|
* @param empresaId - Empresa para ser filtrada
|
||||||
* @throws BusinessException
|
* @throws BusinessException
|
||||||
*/
|
*/
|
||||||
public void atualizarTaxaEmbarque(Integer rutaId, Integer orgaoConcedenteId,boolean gerarTabelaZerada, Integer empresaId) throws BusinessException;
|
public void atualizarTaxaEmbarque(List<Ruta> lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, Integer empresaId) throws BusinessException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +116,7 @@ public interface TarifaOficialService {
|
||||||
* @param orgaoId-Se informado, será filtrado pelo orgão
|
* @param orgaoId-Se informado, será filtrado pelo orgão
|
||||||
* @throws BusinessException
|
* @throws BusinessException
|
||||||
*/
|
*/
|
||||||
public void atualizarSeguro(Integer rutaId, Integer orgaoId) throws BusinessException;
|
public void atualizarSeguro(List<Ruta> lsRuta, Integer orgaoId) throws BusinessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link TarifaOficialDAO#aplicarArredondamentoTarifa(Integer, Integer)}
|
* See {@link TarifaOficialDAO#aplicarArredondamentoTarifa(Integer, Integer)}
|
||||||
|
@ -127,7 +130,7 @@ public interface TarifaOficialService {
|
||||||
|
|
||||||
public void borrar(TarifaOficial tarifaOficial);
|
public void borrar(TarifaOficial tarifaOficial);
|
||||||
|
|
||||||
public void gerarAtualizarTabelaZerada(Integer rudaId, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException ;
|
public void gerarAtualizarTabelaZerada(List<Ruta> lsRuta, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException ;
|
||||||
|
|
||||||
public void atualizarPedagio();
|
public void atualizarPedagio();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.rjconsultores.ventaboletos.dao.SeguroKmDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
@ -54,12 +55,25 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
public void gerarAtualizarTarifa(Integer rutaId, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException {
|
public void gerarAtualizarTarifa(List<Ruta> lsRuta, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException {
|
||||||
log.info("gerarAtualizarTarifa= rudaId:"+rutaId+";orgaoConcedenteId:"+orgaoConcedenteId+";empresaId:"+empresaId);
|
|
||||||
|
|
||||||
// Limpando a tabela de TARIFA_OFICIAL
|
// Limpando a tabela de TARIFA_OFICIAL
|
||||||
tarifaOficialDAO.limparTarifasOficiais();
|
tarifaOficialDAO.limparTarifasOficiais();
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
x = lsRuta.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
do{
|
||||||
|
Integer rutaId = null;
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
Ruta r = lsRuta.get(x-1);
|
||||||
|
rutaId = r.getRutaId();
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("gerarAtualizarTarifa= rudaId:"+rutaId+";orgaoConcedenteId:"+orgaoConcedenteId+";empresaId:"+empresaId);
|
||||||
|
|
||||||
//Gerando as tarifas pelo coeficiente
|
//Gerando as tarifas pelo coeficiente
|
||||||
if(orgaoConcedenteId ==null || orgaoConcedenteId != OrgaoConcedente.CODIGO_ARTESP){
|
if(orgaoConcedenteId ==null || orgaoConcedenteId != OrgaoConcedente.CODIGO_ARTESP){
|
||||||
Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedenteId, empresaId);
|
Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedenteId, empresaId);
|
||||||
|
@ -71,26 +85,42 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
Integer qtdTarifaArtesp = tarifaOficialDAO.gerarTarifaArtesp(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, empresaId);
|
Integer qtdTarifaArtesp = tarifaOficialDAO.gerarTarifaArtesp(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, empresaId);
|
||||||
log.info("qtdTarifaArtesp="+qtdTarifaArtesp);
|
log.info("qtdTarifaArtesp="+qtdTarifaArtesp);
|
||||||
}
|
}
|
||||||
|
x--;
|
||||||
|
}while(x > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
public void gerarAtualizarTabelaZerada(Integer rutaId, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException {
|
public void gerarAtualizarTabelaZerada(List<Ruta> lsRuta, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException {
|
||||||
// Limpando a tabela de TARIFA_OFICIAL
|
// Limpando a tabela de TARIFA_OFICIAL
|
||||||
tarifaOficialDAO.limparTarifasOficiais();
|
tarifaOficialDAO.limparTarifasOficiais();
|
||||||
|
|
||||||
|
int x =0;
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
x = lsRuta.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
do{
|
||||||
|
Integer rutaId =null;
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
rutaId = lsRuta.get(x-1).getRutaId();
|
||||||
|
}
|
||||||
|
|
||||||
//Gerando as tarifas
|
//Gerando as tarifas
|
||||||
tarifaOficialDAO.gerarTabelaZerada(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, empresaId);
|
tarifaOficialDAO.gerarTabelaZerada(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, empresaId);
|
||||||
|
|
||||||
|
x--;
|
||||||
|
}while(x > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
public void atualizarTaxaEmbarque(Integer rutaId, Integer orgaoConcedenteId,boolean gerarTabelaZerada, Integer empresaId) throws BusinessException{
|
public void atualizarTaxaEmbarque(List<Ruta> lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, Integer empresaId) throws BusinessException{
|
||||||
if (gerarTabelaZerada){
|
if (gerarTabelaZerada){
|
||||||
gerarAtualizarTabelaZerada(rutaId, orgaoConcedenteId, empresaId);
|
gerarAtualizarTabelaZerada(lsRuta, orgaoConcedenteId, empresaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
tarifaOficialDAO.atualizarTaxaEmbarque(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, empresaId);
|
tarifaOficialDAO.atualizarTaxaEmbarque(lsRuta, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, empresaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,7 +139,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
public void atualizarSeguro(Integer rutaId, Integer orgaoId) throws BusinessException {
|
public void atualizarSeguro(List<Ruta> lsRuta, Integer orgaoId) throws BusinessException {
|
||||||
|
|
||||||
List<Integer> lsOrgaoId = new ArrayList<Integer>();
|
List<Integer> lsOrgaoId = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -119,6 +149,16 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
lsOrgaoId.add(orgaoId);
|
lsOrgaoId.add(orgaoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
x = lsRuta.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
do{
|
||||||
|
Integer rutaId = null;
|
||||||
|
if(lsRuta != null && !lsRuta.isEmpty()){
|
||||||
|
rutaId = lsRuta.get(x-1).getRutaId();
|
||||||
|
}
|
||||||
//O seguro por km é preferencial em relação ao por tarifa.
|
//O seguro por km é preferencial em relação ao por tarifa.
|
||||||
for (Integer orgaoConcedenteId : lsOrgaoId) {
|
for (Integer orgaoConcedenteId : lsOrgaoId) {
|
||||||
if (seguroKmDAO.existe(orgaoConcedenteId)) {
|
if (seguroKmDAO.existe(orgaoConcedenteId)) {
|
||||||
|
@ -127,6 +167,8 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
atualizarSeguroPorTarifa(rutaId, orgaoConcedenteId);
|
atualizarSeguroPorTarifa(rutaId, orgaoConcedenteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
x--;
|
||||||
|
}while(x > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue